package com.payroll.action;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Category;

import com.payroll.framework.Foundation;

/**
 * Servlet implementation class for Servlet: PayrollActionServlet
 *
 */
 public class PayrollActionServlet extends org.apache.struts.action.ActionServlet  {
   static final long serialVersionUID = 1L;

    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public PayrollActionServlet() {
		super();
	}
	/**
	 * Any custom processing that needs to take place in the servlet at init time.
	 *
	 * @exception javax.servlet.UnavailableException Any exceptions the servlet
	 *  might throw at start-up will prevent servlet from loading
	 */
	public void init() throws javax.servlet.ServletException {
		super.init();

		Category cat = Category.getInstance(this.getClass().getName() + ".init");

		try {
			// Load the Tran Stats Manager
			if (System.getProperty("tranStatsOn") != null) {
                if (System.getProperty("tranStatsOn").equalsIgnoreCase("true")) {
                    Foundation.setTranStats(true);
                }
            }
			else {
                if (Foundation.getProperty("tranStatsOn").equals("true")) {
                    Foundation.setTranStats(true);
                } else {
                    Foundation.setTranStats(false);
                }
            }


			// Set the Foundation Servlet Context
			Foundation.setServletContext(this.getServletContext());
			// Initialize application objects
			Foundation.initialize();
		} catch (Exception e) {
			cat.fatal("Failed to load AMSActionServlet servlet. Application " +
                      "will not be accessible.", e);
			throw new javax.servlet.UnavailableException(e.getMessage());
		}

        	}


	}